﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body class="easyui-layout">

    <link href="../hcjsui/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../hcjsui/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" type="text/css" />

    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../hcjsui/jquery-easyui-1.3.3/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../hcjsui/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js" charset="utf-8" type="text/javascript"></script>
    <script src="../hcjsui/Scripts/jquery.form.js" type="text/javascript"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script src="../hcjsui/Scripts/jquery.validate.js" type="text/javascript"></script>
    <script src="../hcjsui/js/easyui-extend/form.js" type="text/javascript"></script>

    <script type="text/javascript" src="../js/hc.js"></script>
    <div region="north" title="人员管理" split="false" border="false" style="height: 60px;">
        <table width="98%">
            <tr>
                <td class="auto-style1">
                    <form id="searchForm" method="post" runat="server">
                        <div>
                            类型：
                                <select id="nofindtype" name="nofindtype" style="width: 150px;" disabled="disabled">
                                    <option value="机构">机构</option>
                                    <option value="银行">银行</option>
                                </select>
                            单位名称：<input id="findBranchID" name="findBranchID_d"  />

                            部门：
                             <input id="findDepID" name="findDepID_d" />

                            <img style="cursor: pointer; vertical-align: middle;" onclick="$('#findDepID').combotree('clear');"
                                alt="清空部门" title="清空部门" src="../img/edit-clear.png" />
                            名称：<input id="findEmpName" name="findEmpName" />
                            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="javascript:Search();">查询</a>&nbsp;&nbsp;<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="javascript:Reset();">重置</a>
                        </div>
                    </form>
                </td>

            </tr>
        </table>
    </div>
    <div region="center" title="人员列表" style="padding: 0px;" border="false">

        <table id="grid1"></table>

    </div>
    <div id="itemEditContainer" title="信息管理" style="width: 650px; height: 400px; display: none;">
        <div class="edititemblock" style="padding: 0px 0px 0px 0px; font-size: 17px;">

            <table cellpadding="5px" width="100%" style="font-size: 17px;">
                <tr>
                    <td>
                        <form id="itemEdit" name="itemEdit" method="post" action="../ashx/sp.ashx">
                            <input type="hidden" class="actionValue" id="editAction" name="action" value="" />
                            <input type="hidden" id="id" name="id" />
                            <input type="hidden" id="tablename" name="tablename" value="" />
                            <input type="hidden" id="tablemidname" name="tablemidname" value="" />
                            <div id="divtabuser" class="easyui-tabs" style="width: 610px; height: 290px;">
                                <div title="基本信息" style="padding: 6px;">
                                    <table cellpadding="0px" width="100%">
                                        <tr>
                                            <td>单位：</td>
                                            <td>
                                                <input id="fDepBrachId" name="fDepBrachId" />


                                            </td>


                                            <td>部门：</td>
                                            <td>
                                                <input id="fDepID" name="fDepID" />

                                                <img style="cursor: pointer; vertical-align: middle;" onclick="$('#fDepID').combotree('clear');"
                                                    alt="清空部门" title="清空部门" src="../img/edit-clear.png" /></td>

                                        </tr>
                                        <tr>
                                            <td>登记账号：</td>
                                            <td>
                                                <input type='text' id='fLoginID' name='fLoginID' /></td>

                                            <td>登记密码：</td>
                                            <td>
                                                <input type='text' id='fPassword' name='fPassword' /></td>
                                        </tr>
                                        <tr>
                                            <td>姓名：</td>
                                            <td>
                                                <input type='text' id='fEmpName' name='fEmpName' /></td>
                                            <td>性别:</td>
                                            <td>
                                                <select id="fSex" name="fSex" style="width: 150px;">
                                                    <option value="1">先生</option>
                                                    <option value="0">女士</option>
                                                </select></td>

                                        </tr>
                                        <tr>
                                            <td>座机：</td>
                                            <td>
                                                <input type='text' id='fOfficeTel' name='fOfficeTel' /></td>
                                            <td>手机：</td>
                                            <td>
                                                <input type='text' id='fMobile' name='fMobile' /></td>

                                        </tr>
                                        <tr>
                                            <td>邮箱：</td>
                                            <td>
                                                <input type='text' id='fEmail' name='fEmail' /></td>
                                            <td>传真：</td>
                                            <td>
                                                <input type='text' id='fOfficeFax' name='fOfficeFax' /></td>

                                        </tr>
                                        <tr>
                                            <td>QQ：</td>
                                            <td>
                                                <input type='text' id='fQQ' name='fQQ' /></td>
                                            <td></td>
                                            <td></td>

                                        </tr>
                                    </table>
                                </div>
                                <div title="个人信息" id="divadduser" style="overflow: auto; padding: 6px;" data-options="closable:false">
                                    <table cellpadding="0px" width="100%">
                                        <tr>
                                            <td>省：</td>
                                            <td>
                                                <input type='text' id='fProvince' name='fProvince' /></td>
                                            <td>身份证：</td>
                                            <td>
                                                <input type='text' id='IDCardNo' name='IDCardNo' /></td>

                                        </tr>
                                        <tr>
                                            <td>市：</td>
                                            <td>
                                                <input type='text' id='fCity' name='fCity' /></td>
                                            <td>籍贯：</td>
                                            <td>
                                                <input type='text' id='fNaPlace' name='fNaPlace' /></td>

                                        </tr>
                                        <tr>
                                            <td>县：</td>
                                            <td>
                                                <input type='text' id='fDistrict' name='fDistrict' /></td>
                                            <td>住址：</td>
                                            <td>
                                                <input type='text' id='fhomewhere' name='fhomewhere' />
                                            </td>

                                        </tr>
                                        <tr>
                                            <td>街道：</td>
                                            <td>
                                                <input type='text' id='fStreet' name='fStreet' /></td>
                                            <td></td>
                                            <td></td>

                                        </tr>
                                        <tr>
                                            <td>毕业院校：</td>
                                            <td>
                                                <input type='text' id='fSchool1' name='fSchool1' /></td>
                                            <td>学历:</td>
                                            <td>
                                                <input type='text' id='fEduCat1' name='fEduCat1' /></td>

                                        </tr>
                                        <tr>
                                            <td>毕业时间：</td>
                                            <td>
                                                <input type='text' id='fGerTime1' name='fGerTime1' /></td>
                                            <td>专业:</td>
                                            <td>
                                                <input type='text' id='fSpecial1' name='fSpecial1' /></td>

                                        </tr>
                                        <tr>
                                            <td>入职时间：</td>
                                            <td>
                                                <input type='text' id='fEnterDate' name='fEnterDate' /></td>
                                            <td>转正时间:</td>
                                            <td>
                                                <input type='text' id='fOkDate' name='fOkDate' /></td>

                                        </tr>
                                        <tr>
                                            <td>离职时间：</td>
                                            <td>
                                                <input type='text' id='fOutDate' name='fOutDate' /></td>
                                            <td>在职状态:</td>
                                            <td>
                                                <input type='text' id='fworkstate' name='fworkstate' /></td>

                                        </tr>
                                    </table>
                                </div>
                                <div title="用户角色" style="padding: 6px;">
                                    角色修改不需要保存，即可生效。<br />
                                    角色：<input id="nofRoleinfo" name="nofRoleinfo" />



                                    <a class="easyui-linkbutton btn-save" data-options="iconCls:'icon-add'" href="javascript:void(0)" onclick="javascript:adduserrole();">添加角色</a>
                                    <br />
                                    <table id="gridrole"></table>
                                </div>
                                <div title="人员照片" style="padding: 6px;">
                                    <table>
                                        <tr>
                                            <td>相片<img id="imgExist" src="" width="110px" height="150px"></td>
                                            <td style="width: 200px;">
                                                <div id="uploadfileQueue" style="padding: 3px;"></div>
                                                <div id="file_upload"></div>
                                                <br />
                                                <img alt="" src="../uploadifyjs/images/BeginUpload.gif" width="77" height="23" onclick="doUplaod()" />
                                                <img alt="" src="../uploadifyjs/images/CancelUpload.gif" width="77" height="23" onclick="closeLoad()" />
                                            </td>
                                        </tr>
                                    </table>
                                    <input type="hidden" id="fPhotoId" name="fPhotoId" value="" />

                                    <br />
                                    <!-- <div>
                                        <table id="attAchments"></table>
                                    </div>
                                    <a id="attach" style="font-family: 宋体; font-size: 9pt;" title="如果您要发送多个附件，您只需多次点击“继续添加附件”即可,
    要注意附件总量不能超过发送限制的大小。"
                                        onclick="AddAttachments();"
                                        href="javascript::void(0);" name="attach">添加附件</a>
                                    &nbsp;<a href="#" id="A2" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="javascript:upFiles();">上传（要保存才生效）</a>
                                    <table width="300px" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
                                        <tr>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                        </tr>
                                    </table>-->
                                </div>


                            </div>
                        </form>
                    </td>

                </tr>


                <tr>
                    <td colspan="2" align="center">
                        <a class="easyui-linkbutton btn-save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:editSubmit();">保存</a>
                        <a class="easyui-linkbutton btn-cancel" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#itemEdit')[0].reset();">重置</a></td>
                </tr>
            </table>


        </div>
    </div>

    <!--文件上传方法1-->
    <!--<script src="../uploadifyjs/ajaxfileupload.js" type="text/javascript"></script>
    <script type="text/javascript" src="../newbasejs/fileajax.js"></script>-->

    <!-- 文件上传方法2-->
    <link href="../uploadifyjs/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="../uploadifyjs/swfobject.js" type="text/javascript"></script>
    <script src="../uploadifyjs/jquery.uploadify.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../newbasejs/uploadify.js"></script>

    <script type="text/javascript">
       
        var isfloadae = true;
        var showtype;
        spsetBaseNoBt("mrBaseInf", "EmpID", "View_User as T", "T.EmpID as EmpID,T.LoginID as LoginID,T.EmpName as EmpName,T.BranchName as BranchName,T.DepName as DepName,T.OfficeTel as OfficeTel", "#grid1", "mruser");
        var Mbranchobj;//机构对象
        var Mbankobj;
        $(function () {
            
            $('#nofindtype').combobox({

            });
            showtype = getUrlParam("showtype");
            if (showtype == 0) {
                $("#nofindtype").combobox("select", "机构");
            }
            else if (showtype == 1) {
                $("#nofindtype").combobox("select", "银行");
            }
            else {
                $.messager.alert("提示信息", "没定义的参数！");
                return;
            }
            $.ajaxSetup({
                async: true
            });


            if (showtype == 0)
                hcdosel("BranchID,BranchName", "mrBranch", "type in('本部','分部')", "", "", "BranchID", function (data) {
                    Mbranchobj = $.parseJSON(data);
                    if (showtype == 0) {
                        $("#findBranchID").combobox("loadData", Mbranchobj);
                        BindGrid();
                    }
                    else if (showtype == 1) {
                    }
                });

            if (showtype == 1)
                hcdosel("BranchID,BranchName", "mrBranch", "type in('银行','分行','一级支行')", "", "", "BranchID", function (data) {
                    Mbankobj = $.parseJSON(data);
                    if (showtype == 0) {
                        // $("#findBranchID").combobox("loadData", Mbranchobj);
                    }
                    else if (showtype == 1) {
                        $("#findBranchID").combobox("loadData", Mbankobj);
                        BindGrid();
                    }
                });


            $('#findBranchID').combobox({
                editable: false,
                valueField: 'BranchID',
                textField: 'BranchName',
                multiple: false,
                onChange: function (newValue, oldValue) {
                    runloadselecttree("#findDepID", newValue);
                },
                onLoadSuccess: function () {
                    var val = $(this).combobox("getData");
                    for (var i = 0; i < val.length; i++) {
                        if (val[i]["BranchID"] == HCUser.HCUorg) {
                            $(this).combobox("select", val[i]["BranchID"]);
                            break;
                        }
                    }
                    if (HCUser.HCUorg != 106) {
                        $('#findBranchID').combobox('readonly', true);
                    }
                }
            });



        });
        var urltree = sposelTreeUrl("mrDepartment as T inner join mrBranch  as T1 on T.BranchID=T1.BranchID  ", " DepID as ID,DepName  as ShowInfo,T1.BranchName as ShowInfo2,T.ParentId");
        //"../ashx/sp.ashx?action=seltree&tableinfo= mrDepartment as T inner join mrBranch  as T1 on T.BranchID=T1.BranchID   &refields=";
        function runloadselecttree(sid, id) {
            $(sid).combotree({
                url: urltree + '&wheresp= and T.BranchID=' + id
                //onBeforeExpand: function (node) {
                //    $('#fParentId').combotree("tree").tree("options").url = urltree + '&wheresp= and T.BranchID='+id;
                //}
            });
        }
        function BindGrid() {
            $(grid1ID).datagrid({
                pagination: true, //是否显示分页控件
                fitColumns: true, //是否自适应宽度
                fit: true, //是否自适应父容器的大小
                loadMsg: "努力加载中...", //加载数据时，显示的提示信息
                rownumbers: true, //是否显示行号
                singleSelect: false, //是否单选
                remoteSort: false, //是否启用服务器排序
                //sortName: "id", //排序字段
                sortOrder: "ASC", //排序类型
                striped: true, //行显示交替背景
                idField: pTableIdName,
                pageSize: 5,

                // checkOnSelect :false,
                pageList: [10, 15, 20, 30, 40, 50],
                toolbar:
          [
              { id: 'btnAdd', text: '新增', iconCls: 'icon-add', handler: toolAdd },
              { id: 'btnDel', text: '删除', iconCls: 'icon-delete', handler: toolDelete },
              { id: 'btnImport', text: '导入', iconCls: 'icon-upload', handler: toolImport },
              { id: 'btnExport', text: '导出', iconCls: 'icon-download', handler: toolExport }
          ],
                columns: [[
                   { field: "EmpID", title: "ID", width: 80, sortable: true, checkbox: true },
                   { field: "LoginID", title: "账号", width: 100 },
                   { field: "EmpName", title: "姓名", width: 80, sortable: true },
                   { field: "BranchName", title: "机构", width: 80 },
                   { field: "DepName", title: "部门", width: 80 },
                   { field: "OfficeTel", title: "电话", width: 80 },

                   {
                       field: "y", title: "操作", width: 50, align: "center", formatter: function (value, row, index) {
                           return "<a href='#' style='color: #369591;' onclick='javascript:Update(" + index + ")'>修改</a>";
                       }
                   }
                ]],

                onLoadSuccess: function (data) {
                    switch (data.message) {
                        case JsonResult.SessionOut:
                            $.messager.alert('系统出错', ' 登录超时，请重新登录!');
                            break;
                        case JsonResult.Error:
                            $.messager.alert('系统出错', data.erinfo);
                            break;
                    }
                },
                onBeforeLoad: function (param) {
                    if (!$(this).datagrid('options').url) {
                        $(this).datagrid('options').url = spselUrl();// pageUrl + "?action=sel&tableinfo=" + selTableinfo + "&refields=" + selFieldsinfo + "";
                    }
                    $.extend(param, $("#searchForm").formToJson());
                }
            });
        }
        //第一次弹时加载
        function loadiniaddedit() {
            if (isfloadae) {
                isfloadae = false;
                $('#fSex').combobox({
                });
                $('#fOutDate').addClass("easyui-datebox");
                $('#fOkDate').addClass("easyui-datebox");
                $('#fEnterDate').addClass("easyui-datebox");
                $('#fGerTime1').addClass("easyui-datebox");
                $('#fDepBrachId').attr('required', true);
                $('#fDepID').attr('required', true);

                //  required = 'true'
                //!!!
                $.parser.parse("#divadduser");
                $('#fDepBrachId').combobox({
                    editable: false,
                    valueField: 'BranchID',
                    textField: 'BranchName',
                    multiple: false,
                    // data: datebranch,
                    onChange: function (newValue, oldValue) {
                        runloadselecttree("#fDepID", newValue);
                    },
                    onLoadSuccess: function () { //加载完成后,设置选中第一项
                        var val = $(this).combobox("getData");
                        for (var item in val[0]) {
                            if (item == "BranchID") {
                                $(this).combobox("select", val[0][item]);
                            }
                        }
                    }
                });
                $('#nofRoleinfo').combobox({
                    editable: false,
                    valueField: 'RoleID',
                    textField: 'RoleName',
                    multiple: false,
                    url: "../ashx/sp.ashx?action=SqlTableGet&nostate=no&sqlinfo=select[RoleID,RoleName]table[sysRolesDic]where[]group[]having[]order[]"

                });

                if (showtype == 0) {
                    $("#fDepBrachId").combobox("loadData", Mbranchobj);
                }
                else if (showtype == 1) {
                    $("#fDepBrachId").combobox("loadData", Mbankobj);
                }
                $("#gridrole").datagrid({
                    pagination: false, //是否显示分页控件
                    // fitColumns: true, //是否自适应宽度
                    fit: true, //是否自适应父容器的大小
                    loadMsg: "努力加载中...", //加载数据时，显示的提示信息
                    //rownumbers: true, //是否显示行号
                    singleSelect: false, //是否单选
                    remoteSort: false, //是否启用服务器排序
                    //sortName: "id", //排序字段
                    striped: true, //行显示交替背景
                    idField: "PKID",
                    columns: [[
                       { field: "RoleName", title: "名称", width: 80, sortable: true },
                       {
                           field: "y", title: "移除", width: 50, align: "center", formatter: function (value, row, index) {
                               return "<a href='#' style='color: #369591;' onclick='javascript:deleteRole(" + row.PKID + ")'>移除</a>";
                           }
                       }
                    ]],
                    onBeforeLoad: function (param) {

                    }
                });
            }
        }
        function Search() {
            $(grid1).datagrid("load");
        }

        function Reset() {
            $("#findRoleName").val("");
        }


        function Update(index) {
            $("#itemEditContainer").show();
            loadiniaddedit();
            $("#imgExist").attr("src", "");
            $(".validatebox-tip").remove();
            $(".validatebox-invalid").removeClass("validatebox-invalid");
            $(grid1ID).datagrid("selectRow", index);
            var row = $(grid1ID).datagrid("getSelected");
            $('#itemEdit')[0].reset();
            $("#editAction").val(CallBackCommand.Update);

            var id = row[pTableIdName];
            $("#id").val(id);
            $("#divtabuser").tabs("select", 0);
            var PhotoId = "";
            //方法2从数据库中找出(内容不在列表时)
            {
                $.get(spselrowUrl(id) + "&timenow=" + new Date().getTime(), //"../ashx/sp.ashx?action=GetTableObjINFO&talbename=" + pTableName + "&midname=" + pTableIdName + "&midvalue=" + id,
                    function (data) {
                        var data = JSON.parse(data);
                        if (data.message == JsonResult.Success) {
                            var DepID;
                            for (var i = 0; i < data.data.length; i++) {
                                var infoobj = data.data[i];
                                for (var filedname in infoobj) {
                                    var gethtmlf = $("#f" + filedname);
                                    if (gethtmlf && gethtmlf.length == 1) {
                                        if (filedname == "DepBrachId") {
                                            var dfdf = 1;
                                        }
                                        var classname = gethtmlf.attr("class");
                                        if (classname == null || classname == 'undefined') {
                                            gethtmlf.val(infoobj[filedname]);
                                        }
                                        else if (classname.indexOf('-combobox') >= 0 || classname.indexOf('combobox-') >= 0) {
                                            gethtmlf.combobox('setValue', infoobj[filedname]);
                                        }
                                        else if (classname.indexOf('-combotree') >= 0) {
                                            gethtmlf.combotree('setValue', infoobj[filedname]);
                                        }
                                        else if (classname.indexOf('-datebox') >= 0 || classname.indexOf('-datetimebox') >= 0) {
                                            gethtmlf.datebox('setValue', infoobj[filedname]);
                                        }
                                        else { gethtmlf.val(infoobj[filedname]); }


                                        if (filedname == "DepID") {//如是机构没加载，------
                                            DepID = infoobj[filedname];
                                        }
                                        else if (filedname == "PhotoId")
                                        { PhotoId = infoobj[filedname]; }
                                    }
                                }
                                {
                                    //最后才加载
                                    $("#fDepID").combotree('setValue', DepID);
                                    $("#imgExist").attr("src", "../ashx/GetPhotoHandler.ashx?mid=" + PhotoId);
                                }
                                break;
                            }
                            //加载角色
                            $("#gridrole").datagrid('options').url = sposelUrl("sysEmpRoles as T  inner join sysRolesDic AS T1 on T.RoleID=T1.RoleID", "T.PKID,T1.RoleName", "and T.EmpID=" + id);// pageUrl + "?action=sel&tableinfo= sysEmpRoles as T  inner join dbo.sysRolesDic AS T1 on T.RoleID=T1.RoleID &refields=T.PKID,T1.RoleName&wheresp= and T.EmpID=" + id;
                            $("#gridrole").datagrid("load");
                        }
                        else {
                            $.messager.show({
                                title: '查找出错',
                                msg: data.data,
                                showType: 'show'
                            });
                        }


                    });


            }


            $('#itemEditContainer').window({ title: "修改信息" });
            $("#itemEditContainer").window("open");
        }


        function toolDelete() {
            var rows = $(grid1ID).datagrid("getSelections");
            if (rows.length == 0) {
                $.messager.alert("提示信息", "请选择需要删除的数据！");
            } else {
                $.messager.confirm("提示信息", "确定删除所选数据？", function (r) {
                    if (!r) {
                        $(grid1ID).datagrid("clearSelections");
                        return;
                    }
                    var ID = "";
                    for (var i = 0; i < rows.length; i++) {
                        ID += rows[i][pTableIdName] + ",";
                    }
                    ID = ID.substring(0, ID.length - 1);
                    $.get(spdelUrl(ID),
                    function (data) {
                        var data = JSON.parse(data);
                        switch (data.message) {
                            case JsonResult.SessionOut:
                                $.messager.alert('系统出错', ' 登录超时，请重新登录!');
                                break;
                            case JsonResult.Error:
                                $.messager.alert('系统出错', data.data);
                                break;
                            case JsonResult.Success:
                                $.messager.show({
                                    title: '提示信息',
                                    msg: data.data,
                                    showType: 'show'
                                });
                                $(grid1ID).datagrid("clearSelections");
                                $(grid1ID).datagrid("load");
                                break;
                        }
                    });
                });
            }
        }
        function deleteRole(ID) {
            $.get(spodelUrl("sysEmpRoles", "PKID", ID),
                   function (data) {
                       var data = JSON.parse(data);
                       switch (data.message) {
                           case JsonResult.SessionOut:
                               $.messager.alert('系统出错', ' 登录超时，请重新登录!');
                               break;
                           case JsonResult.Error:
                               $.messager.alert('系统出错', data.data);
                               break;
                           case JsonResult.Success:
                               $.messager.show({
                                   title: '提示信息',
                                   msg: data.data,
                                   showType: 'show'
                               });

                               $("#gridrole").datagrid("reload");
                               break;
                       }
                   });
        }
        function adduserrole() {
            if ($("#id").val() == "") {
                $.messager.alert('提示', ' 请先保存用户信息');
                return;
            }
            if ($("#nofRoleinfo").combobox('getValue') == "") {
                $.messager.alert('提示', '请从下拉中选择角色');
                return;
            }
            var addinfo = "empid%" + $("#id").val() + "$roleid%" + $("#nofRoleinfo").combobox('getValue');
            hcdoadd("sysEmpRoles", addinfo, function (info) { if (info == "ok") $("#gridrole").datagrid("reload"); });
        }

        function toolAdd() {
            $("#itemEditContainer").show();
            loadiniaddedit();
            $("#divtabuser").tabs("select", 0);
            $('#itemEdit')[0].reset();
            $("#editAction").val(CallBackCommand.Inseart);
            $('#itemEditContainer').window({ title: "新增信息" });
            $("#itemEditContainer").window("open");
            $("#fDepBrachId").combobox("select", HCUser.HCUorg);
            if (HCUser.HCUorg != 106) {
                $('#fDepBrachId').combobox('readonly', true);
            }
        }

        function editSubmit() {
            $("#tablename").val(pTableName);
            $("#tablemidname").val(pTableIdName);
            if (!$("#itemEdit").form('validate'))
            { return; }
            $("#attAchments").html("");//清空附件行 
            $("#attach").text("添加附件");
            $('#itemEdit').ajaxSubmit(function (message) {
                var data = JSON.parse(message);
                if (data.message == JsonResult.Success) {
                    $('#itemEditContainer').window('close');
                    $.messager.show({
                        title: '消息',
                        msg: '信息提交成功',
                        showType: 'show'
                    });
                    $(grid1ID).datagrid("reload");
                }
                else {
                    $.messager.show({
                        title: '提交出错',
                        msg: data.data,
                        showType: 'show'
                    });
                }

            });

        }

        //以下可公用
        var SetSelectWithObjIdName = function (sel, objData) {
            $(sel).children().remove();
            $(sel).append("<option value='' selected='selected'></option>");
            for (var i = 0; i < objData.length; i++) {
                if (i == 0) {
                    $(sel).append("<option value='" + objData[i].id + "' >" + objData[i].name + "</option>");
                } else {
                    $(sel).append("<option value='" + objData[i].id + "'>" + objData[i].name + "</option>");
                }

            }

        }
        function toolExport() {
            hcdoExport("*", "View_User", "", "", "", "");
        }
    </script>
    <div id="ImportShow" class="easyui-window" title="导入线路信息" data-options="iconCls:'icon-import',modal:true,shadow:true,closed:true" style="width: 550px; height: 150px; padding: 10px;">
        <form id="importForm" action="../ashx/sp.ashx" method="post" enctype="multipart/form-data">
            <input type="hidden" id="action" name="action" value="Import" />
            <input type="hidden" id="imptablename" name="imptablename" value="mrBaseInf" /><!--导入的表-->
            <!--  <input type="hidden" id="impspfv" name="impspfv" value="type:20150901,typename:测试数据"/>-->
            <!--导入的表，默认字段值 中文啊，放到url中处理-->
            <input type="hidden" id="improwstart" name="improwstart" value="0" /><!--从第0行开始-->
            <input type="hidden" id="impcellstart" name="impcellstart" value="0" /><!--从第0列开始-->
            <input type="hidden" id="impfield" name="impfield" value="EmpName,DepID,LoginID,Password" /><!--从左到右对应的字段-->
            <table cellpadding="5px">
                <tr>
                    <td class="auto-style1">导入文件：</td>
                    <td class="auto-style1">
                        <input type="file" id="importFile" name="importFile" /></td>
                    <td class="auto-style1"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-upload'" onclick="javascript:Import();">上传</a></td>
                    <!--onclick="javascript:Import('impspfv=','type:20150901,typename:测试数据');"-->
                </tr>
                <tr>
                    <td colspan="3">
                        <div id="importMsg"></div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>
</html>
